---
title: Checkbox | gluestack-ui | Installation, Usage, and API

description: Whether you're building a simple form or a complex data collection system, the Checkbox component offers a user-friendly way for users to select multiple options from a list.

pageTitle: Checkbox

pageDescription: Whether you're building a simple form or a complex data collection system, the Checkbox component offers a user-friendly way for users to select multiple options from a list.

showHeader: true
---

import { Meta } from '@storybook/addon-docs';

<Meta title="ui/Components/Forms/Checkbox" />

import {
  Checkbox,
  CheckboxGroup,
  CheckboxIndicator,
  CheckboxIcon,
  CheckboxLabel,
  CheckIcon,
  Icon,
} from './Checkbox';
import { Text, RemoveIcon, FormControl } from './Checkbox';
import { useState, useRef } from 'react';
import { Center, VStack } from './Checkbox';
import { HStack, Heading, Box } from './Checkbox';
import { transformedCode } from '../../../utils';
import {
  AppProvider,
  CodePreview,
  Table,
  TableContainer,
  InlineCode,
} from '@gluestack/design-system';

import Wrapper from '../../Wrapper';

This is an illustration of a **Themed Checkbox** component with default configuration.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={true}
    metaData={{
      code: `
          <Checkbox   {...props}  >
            <CheckboxIndicator mr="$2">
              <CheckboxIcon as={CheckIcon}/>
            </CheckboxIndicator>
            <CheckboxLabel>Label</CheckboxLabel>
          </Checkbox>
      `,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        Wrapper,
        Center,
        CheckIcon,
        Icon,
      },
      argsType: {
        size: {
          control: 'select',
          options: ['sm', 'md', 'lg'],
          default: 'md',
        },
        isInvalid: {
          control: 'boolean',
        },
        isDisabled: {
          control: 'boolean',
        },
      },
    }}
  />
</AppProvider>

<br />

## API Reference

### Import

To use this component in your project, include the following import statement in your file.

```bash
import { Checkbox } from '@gluestack-ui/themed';
```

### Anatomy

The structure provided below can help you identify and understand a Checkbox component's various parts.

```jsx
export default () => (
  <CheckboxGroup>
    <Checkbox>
      <CheckboxIndicator>
        <CheckboxIcon />
      </CheckboxIndicator>
      <CheckboxLabel />
    </Checkbox>
  </CheckboxGroup>
);
```

### Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

#### Checkbox

Contains all Checkbox related layout style props and actions. It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component.

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Prop</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Type</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Description</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>value</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>string</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`The value to be used in the checkbox input. This is the value that will be returned on form submission.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>onChange</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>`(value: boolean) => void`</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Function called when the state of the checkbox changes.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>defaultIsChecked</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`If true, the checkbox will be initially checked.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isChecked</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`When true, the checkbox will be checked. You'll need to pass onChange to update it's value (since it's now controlled).`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isDisabled</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`To manually set disable to the checkbox.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isInvalid</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`To manually set invalid to the checkbox.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isReadOnly</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`To manually set read-only to the checkbox.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isHovered</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`To manually set hover to the checkbox.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isFocusVisible</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>
              {`To manually set focus visible state to the checkbox.`}
            </Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isIndeterminate</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>
              {`To manually set indeterminate to the checkbox.`}
            </Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

**Descendants Styling Props**
Props to style child components.

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Sx Prop</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Description</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>_text</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Prop to style CheckboxLabel Component`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>_icon</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Prop to style CheckboxIcon Component`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>_indicator</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`Prop to style CheckboxIndicator Component`}</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

#### CheckboxIndicator

Contains all indicators related layout style props and actions. It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component.

#### CheckboxIcon

Contains all Icon related layout style props and actions. It inherits all the properties of gluestack Style's [AsForwarder](/style/docs/api/as-forwarder) component.

#### CheckboxLabel

Contains all Label related layout style props and actions. It inherits all the properties of React Native's [Text](https://reactnative.dev/docs/text) component.

#### CheckboxGroup

Contains all Group related layout style props and actions. It inherits all the properties of React Native's [View](https://reactnative.dev/docs/view) component.

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Prop</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Type</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Description</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>value</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>string[]</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`The value of the checkbox group.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>onChange</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`(values: Array<string>) => void`}</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>-</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`The callback fired when any children Checkbox is checked or unchecked.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isDisabled</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`To manually set disable to the checkbox.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isInvalid</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`To manually set invalid to the checkbox.`}</Table.TText>
          </Table.TD>
        </Table.TR>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>isReadOnly</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>bool</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>false</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>{`To manually set read-only to the checkbox.`}</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

### Features

- Keyboard support for actions.
- Support for hover, focus and active states.

### Accessibility

We have outlined the various features that ensure the Checkbox component is accessible to all users, including those with disabilities. These features help ensure that your application is inclusive and meets accessibility standards.Adheres to the [WAI-ARIA design pattern](https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/).

#### Keyboard

- `Tab`: Moves focus to the next focusable element.
- `Shift + Tab`: Moves focus to the previous focusable element.
- `Space`: To check or uncheck focused checkbox.

#### Screen Reader

- VoiceOver: When the checkbox is focused, the screen reader will announce it's a checkbox and it's current state (check or uncheck) and it's label.

#### Focus Management

- The `onFocus` and `onBlur` props to manage focus states and provide visual cues to users. This is especially important for users who rely on keyboard navigation.

#### States

- In error state, `aria-invalid` will be passed to indicate that the radio input has an error, and providing support for an `aria-errormessage` to describe the error in more detail.
- In disabled state, `aria-hidden` will be passed to make radio input not focusable.
- In required state, `aria-required` will be passed to indicate that the radio input is required.

## Themed

The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this [link](https://gluestack.io/ui/docs/core-concepts/themed-library).

### Props

Checkbox component is created using Pressable component from react-native. It extends all the props supported by [React Native Pressable](https://reactnative.dev/docs/pressable#props), [utility props](/ui/docs/styling/utility-and-sx-props) and the props mentioned below.

#### Checkbox

<AppProvider>
  <TableContainer>
    <Table>
      <Table.THead>
        <Table.TR>
          <Table.TH>
            <Table.TText>Name</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Value</Table.TText>
          </Table.TH>
          <Table.TH>
            <Table.TText>Default</Table.TText>
          </Table.TH>
        </Table.TR>
      </Table.THead>
      <Table.TBody>
        <Table.TR>
          <Table.TD>
            <Table.TText>
              <InlineCode>size</InlineCode>
            </Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>lg | md | sm</Table.TText>
          </Table.TD>
          <Table.TD>
            <Table.TText>md</Table.TText>
          </Table.TD>
        </Table.TR>
      </Table.TBody>
    </Table>
  </TableContainer>
</AppProvider>

> Note: These props are exclusively applicable when utilizing the default configuration of gluestack-ui/config. If you are using a custom theme, these props may not be available.

### Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

#### Multiple Checkbox

Checkbox provide a mutually exclusive selection mechanism, allowing users to choose a multiple option from a set of related choices.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
        function App(){
            const [values, setValues] = useState(["Eng"]);
           return (
            <CheckboxGroup value={values}  onChange={(keys) => {
        setValues(keys)
      }}>
                <VStack space="3xl">
                  <Checkbox   value="Eng">
                        <CheckboxIndicator mr="$2">
                          <CheckboxIcon as={CheckIcon}/>
                        </CheckboxIndicator>
                        <CheckboxLabel>Framer</CheckboxLabel>
                  </Checkbox>
                  <Checkbox value="invison">
                      <CheckboxIndicator mr="$2">
                        <CheckboxIcon as={CheckIcon}/>
                      </CheckboxIndicator>
                      <CheckboxLabel>Invision Studio</CheckboxLabel>
                  </Checkbox>
                  <Checkbox  value="adobe">
                    <CheckboxIndicator mr="$2">
                      <CheckboxIcon as={CheckIcon}/>
                    </CheckboxIndicator>
                    <CheckboxLabel>Adobe XD</CheckboxLabel>
                  </Checkbox>
              </VStack>
              </CheckboxGroup>
           )
        }
      `,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        Wrapper,
        Center,
        CheckIcon,
        Icon,
        VStack,
        useState,
      },
      argsType: {},
    }}
  />
</AppProvider>

#### Horizontal

A horizontal component incorporating a checkbox allows for intuitive and space-efficient selection of multiple options within a linear layout.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
          function App(){
             const [values, setValues] = useState(["Illustration"]);
           return (
             <CheckboxGroup value={values}  onChange={(keys) => {
        setValues(keys)
      }}>
                <HStack space="2xl">
                  <Checkbox value="Illustration">
                    <CheckboxIndicator mr="$2">
                      <CheckboxIcon as={CheckIcon}/>
                    </CheckboxIndicator>
                    <CheckboxLabel>Illustration</CheckboxLabel>
                  </Checkbox>
                  <Checkbox value="Animation">
                    <CheckboxIndicator  mr="$2">
                      <CheckboxIcon as={CheckIcon}/>
                    </CheckboxIndicator>
                    <CheckboxLabel>Animation</CheckboxLabel>
                  </Checkbox>
                  <Checkbox value="Typography">
                    <CheckboxIndicator mr="$2">
                      <CheckboxIcon as={CheckIcon}/>
                    </CheckboxIndicator>
                    <CheckboxLabel>Typography</CheckboxLabel>
                  </Checkbox>
               </HStack>
                 </CheckboxGroup>
           )
        }
`,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Wrapper,
        CheckIcon,
        Icon,
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        HStack,
        useState,
      },
      argsType: {},
    }}
  />
</AppProvider>

#### With help text

A checkbox component with help text provides informative guidance alongside selectable options, ensuring clarity and ease of use.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
        function App(){
             const [values, setValues] = useState(["Design"]);
           return (
             <CheckboxGroup value={values}  onChange={(keys) => {
        setValues(keys)
      }}>
               <VStack space="2xl">
            <Box>
              <Checkbox value="Design">
                <CheckboxIndicator mr="$2">
                   <CheckboxIcon as={CheckIcon}/>
                </CheckboxIndicator>
                <CheckboxLabel >Design</CheckboxLabel>
              </Checkbox>
              <Text size="sm" ml="$7" >Subscribe to updates from the Design Feed</Text>
            </Box>
            <Box>
              <Checkbox value="Marketing">
                <CheckboxIndicator mr="$2">
                  <CheckboxIcon as={CheckIcon}/>
                </CheckboxIndicator>
                <CheckboxLabel>Marketing</CheckboxLabel>
              </Checkbox>
              <Text size="sm" ml="$7" >Subscribe to updates from the Marketing Feed</Text>
             </Box>
        </VStack>
                 </CheckboxGroup>
           )
        }
`,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Wrapper,
        CheckIcon,
        Icon,
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        HStack,
        VStack,
        Text,
        Box,
        useState,
      },
      argsType: {},
    }}
  />
</AppProvider>

#### Form Control

A checkbox component integrated with form control enhances the user experience by enabling easy selection and submission of options within a structured input context.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
       <FormControl>
           <VStack space="sm">
              <Heading size="sm" >Sign up for newsletters</Heading>
              <Checkbox >
                  <CheckboxIndicator mr="$2">
                     <CheckboxIcon as={CheckIcon}/>
                  </CheckboxIndicator>
                <CheckboxLabel>Daily Bits</CheckboxLabel>
              </Checkbox>
              <Checkbox >
                <CheckboxIndicator mr="$2">
                  <CheckboxIcon as={CheckIcon}/>
               </CheckboxIndicator>
                 <CheckboxLabel>Event Updates</CheckboxLabel>
              </Checkbox>
              <Checkbox >
                <CheckboxIndicator mr="$2">
                  <CheckboxIcon as={CheckIcon}/>
                </CheckboxIndicator>
                 <CheckboxLabel>Sponsorship</CheckboxLabel>
              </Checkbox>
              <Text size="sm">Subscribe to newsletters for updates</Text>
           </VStack>
            </FormControl>
        `,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        Wrapper,
        Center,
        CheckIcon,
        Icon,
        Text,
        VStack,
        Heading,
        FormControl,
      },
      argsType: {},
    }}
  />
</AppProvider>

#### Label left

A checkbox component with Label left configuration aligns the label to the left, facilitating clear association between the option and its corresponding checkbox.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
       function App(){
             const [values, setValues] = useState(["Jane"]);
           return (
             <CheckboxGroup value={values}  onChange={(keys) => {
        setValues(keys)
      }}>
     <VStack space="lg" w='$40'>
            <Checkbox justifyContent="space-between" value="Jane">
              <CheckboxLabel >Jane Cooper</CheckboxLabel>
                <CheckboxIndicator>
                   <CheckboxIcon as={CheckIcon}/>
                </CheckboxIndicator>
            </Checkbox>
            <Checkbox value="Wade" justifyContent="space-between">
                <CheckboxLabel >Wade Warren</CheckboxLabel>
                  <CheckboxIndicator>
                      <CheckboxIcon as={CheckIcon} />
                  </CheckboxIndicator>
            </Checkbox>
            <Checkbox justifyContent="space-between" value="Robert">
              <CheckboxLabel >Robert Fox</CheckboxLabel>
                <CheckboxIndicator>
                  <CheckboxIcon as={CheckIcon}/>
                </CheckboxIndicator>
            </Checkbox>
          </VStack>
                 </CheckboxGroup>
           )
        }`,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        Wrapper,
        Center,
        CheckIcon,
        Icon,
        VStack,
        HStack,
        useState,
      },
      argsType: {},
    }}
  />
</AppProvider>

#### Controlled

A controlled component architecture incorporates a checkbox component, allowing for precise management of its state and behavior through explicit control mechanisms.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
      function App() {
         const [values, setValues] = React.useState(['UX Research']);
        return (
          <CheckboxGroup value={values}  onChange={(keys)=>{
            setValues(keys);
          }}>
           <VStack space="md">
                  <Checkbox  value="UX Research">
                    <CheckboxIndicator mr="$2">
                      <CheckboxIcon as={CheckIcon}/>
                    </CheckboxIndicator>
                  <CheckboxLabel>UX Research</CheckboxLabel>
                </Checkbox>
                 <Checkbox  value="Software">
                    <CheckboxIndicator mr="$2">
                      <CheckboxIcon as={CheckIcon}/>
                    </CheckboxIndicator>
                  <CheckboxLabel>Software Development</CheckboxLabel>
                </Checkbox>
            </VStack>
          </CheckboxGroup>
        )
      }
      `,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Wrapper,
        CheckIcon,
        Icon,
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        useState,
        Center,
        VStack,
      },
      argsType: {},
    }}
  />
</AppProvider>

#### Uncontrolled

An uncontrolled component utilizes a checkbox component, providing a simpler implementation where the checkbox state is managed internally, without explicit control from external sources.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
function App() {
       const radioRef = useRef(null);
        const handleCheckboxChange = (e) => {
            e.preventDefault();
            const checkboxValue = radioRef.current.checked;
          };
        return (
          <CheckboxGroup  ref={radioRef} >
          <VStack space="md">
                  <Checkbox   onChange={handleCheckboxChange}  value="Apartments">
                    <CheckboxIndicator   mr="$2">
                        <CheckboxIcon as={CheckIcon}/>
                    </CheckboxIndicator>
                     <CheckboxLabel>Apartments</CheckboxLabel>
                  </Checkbox>
                   <Checkbox   onChange={handleCheckboxChange}  value="Residents">
                    <CheckboxIndicator  mr="$2">
                        <CheckboxIcon as={CheckIcon}/>
                    </CheckboxIndicator>
                     <CheckboxLabel>Residents</CheckboxLabel>
                  </Checkbox>
            </VStack>
          </CheckboxGroup>
               )
        }
        `,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'App');
      },
      scope: {
        Wrapper,
        CheckIcon,
        Icon,
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        useRef,
        Center,
        VStack,
      },
      argsType: {},
    }}
  />
</AppProvider>

#### Checkbox group

The checkbox group component allows users to group checkbox and display them in a horizontal or vertical row for better visual representation and functionality.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
function CheckboxExample(){
  const [values, setValues] = React.useState([]);
  return (
      <Center>
        <CheckboxGroup
          value={values}
          onChange={setValues}
        >
          <VStack space="sm">
            <Checkbox
            isDisabled={true}
              value="Label 1"
            >
              <CheckboxIndicator mr="$2">
                <CheckboxIcon as={CheckIcon}/>
              </CheckboxIndicator>
              <CheckboxLabel>Label 1</CheckboxLabel>
            </Checkbox>
            <Checkbox
              value="Label 2"
            >
              <CheckboxIndicator mr="$2">
                <CheckboxIcon as={CheckIcon}/>
              </CheckboxIndicator>
              <CheckboxLabel>Label 2</CheckboxLabel>
            </Checkbox>
          </VStack>
        </CheckboxGroup>
      </Center>
  );
};
`,
      transformCode: (code) => {
        return transformedCode(code, 'function', 'CheckboxExample');
      },
      scope: {
        Checkbox,
        CheckboxGroup,
        CheckboxIndicator,
        CheckboxIcon,
        CheckboxLabel,
        Wrapper,
        Center,
        CheckIcon,
        VStack,
      },
      argsType: {},
    }}
  />
</AppProvider>

## Unstyled

All the components in `gluestack-ui` are unstyled by default. To customize your UI using the extendedTheme, please refer to this [link](https://gluestack.io/ui/docs/theme-configuration/customizing-theme/eject-library). The import names of components serve as keys to customize each component.

<!--
### Customizing the Checkbox

We have a function called `createCheckbox` which can be used to create a custom checkbox component. This function takes in a configuration object which contains the styled components that you want to use for the checkbox. You can refer [gluestack.io/style](/style/docs/getting-started/styled) on how to use styled components.

#### Usage

Default styling of all these components can be found in the `components/core/checkbox` file. For reference, you can view the [source code](https://github.com/gluestack/gluestack-ui/blob/main/packages/themed/src/components/Checkbox) of the styled `Checkbox` components.

```jsx
// import the styles
import {
  Root,
  Indicator,
  Icon,
  Label,
  Group,
} from '../components/core/checkbox/styled-components';

// import the createCheckbox function
import { createCheckbox } from '@gluestack-ui/checkbox';

// Understanding the API
const Checkbox = createCheckbox({
  Root,
  Indicator,
  Icon,
  Label,
  Group,
});

// Using the checkbox component
export default () => (
  <CheckboxGroup>
    <Checkbox>
      <CheckboxIndicator>
        <CheckboxIcon />
      </CheckboxIndicator>
      <CheckboxLabel />
    </Checkbox>
  </CheckboxGroup>
);
```

-->

## Spec Doc

Explore the comprehensive details of the Input in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey.

<iframe
  style={{
    borderRadius: '8px',
    border: ' 1px solid rgba(0, 0, 0, 0.1)',
    aspectRatio: 736 / 585,
  }}
  src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Fproto%2FNcXOxqKbdnGsLQNex3H76u%2F%25C2%25A0%25F0%259F%2593%259Agluestack-UI-handbook%3Fpage-id%3D5428%253A25548%26type%3Ddesign%26node-id%3D5428-28718%26viewport%3D627%252C354%252C0.02%26t%3D1lG3EDrkr8YATBXs-1%26scaling%3Dscale-down%26starting-point-node-id%3D5428%253A28718%26mode%3Ddesign"
  allowfullscreen
></iframe>
